/******************************************************************************
 Copyright (c) 2022 Qualcomm Technologies International, Ltd.
 All Rights Reserved.
 Qualcomm Technologies International, Ltd. Confidential and Proprietary.

 REVISION:      $Revision: #5 $
******************************************************************************/

/*!
@file    gatt_gmas_server.h
@brief   Header file for the GATT GMAS (Gaming Audio Service) Server library.

        This file provides documentation for the GATT GMAS server library
        API (library name: gatt_gmas_server).
*/

#ifndef GATT_GMAS_SERVER_H_
#define GATT_GMAS_SERVER_H_

#include <service_handle.h>
#include "csr_bt_gatt_prim.h"
#include "csr_bt_tasks.h"

/* Maximum number of GATT connections */
#define GATT_GMAS_MAX_CONNECTIONS (3)

typedef uint16 GmapRole;
/*! @brief Definition of data required for the initialisation
 *         of the GMAS Server Library.
 */
typedef struct
{
    GmapRole             role;
} GattGmasInitData;


/*!
   @brief GMAP role values
*/
#define GMAP_ROLE_UNICAST_GAME_GATEWAY                       (0x0001)
#define GMAP_ROLE_UNICAST_GAME_TERMINAL                      (0x0002)
#define GMAP_ROLE_BROADCAST_GAME_SENDER                      (0x0004)
#define GMAP_ROLE_BROADCAST_GAME_RECEIVER                    (0x0008)

/*! @brief Instantiate the GATT GMAS Server Service Library.

    The GATT Service Init function is responsible for allocating its instance memory
    and returning a unique service handle for that instance. The Service handle is
    then used for the rest of the API.

    @param theAppTask The client task that will receive messages from this Service.
    @param startHandle The first handle in the ATT database for this Service instance.
    @param endHandle The last handle in the ATT database for this Service instance.
    @param initData The initialisation data to set

    @return ServiceHandle If the service handle returned is 0, this indicates a failure
                             during GATT Service initialisation.
*/
ServiceHandle GattGmasServerInit(AppTask theAppTask,
                                 uint16  startHandle,
                                 uint16  endHandle,
                                 GattGmasInitData* initData);

/*!
    \brief Add configuration for a paired peer device, identified by its
    Connection ID (CID).

    \param srvcHndl Service handle of the GMAS server instance
    \param cid The Connection ID to the peer device.

    \return status_t status of the Add Configuration operation.
*/
status_t GattGmasServerAddConfig(ServiceHandle srvcHndl,
                                 connection_id_t cid);

/*!
    \brief Remove the configuration for a peer device, identified by its
           Connection ID.

    \param srvcHndl Service handle of the GMAS server instance.
    \param cid  Connection ID to the peer device.

    \return bool boolean status of the Remove Configuration operation.
*/
bool GattGmasServerRemoveConfig(ServiceHandle srvcHndl,
                                connection_id_t  cid);

/*!
    @brief This API is used to set the role value.

    @param srvcHndl Service handle of the GMAS server instance.
    @param role Value of Role to set

    @return TRUE if successful, FALSE otherwise

*/
bool GattGmasServerSetRole(ServiceHandle srvcHndl, uint16 role);

/*!
    @brief This API is used when the server application needs to get the role value.

    @param srvcHndl Service handle of the GMAS server instance.

    @return uint16 Role value.
*/
uint16 GattGmasServerGetRole(ServiceHandle srvcHndl);

#endif /* GATT_GMAS_SERVER_H_ */
